<body>

<p>
	The <tt>functor</tt> /**
 * Copyright 2007 Jason Horman, Pete Aykroyd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package contain utilities that facilitates a
	functional programming style in Java. Java 1.5 generics are used
	heavily for compile-time checking of parameter types and function
	arity.
</p>

<p>
	The <tt>Algorithms</tt> class provides a number of typesafe
	utility methods, notably <tt>apply</tt>, <tt>select</tt>,
	and <tt>foreach</tt> from Python, Lisp, and other functional
	languages; there are variations for operating with unary and
	binary functions. The parameters to these methods
	are <tt>Predicate</tt> and <tt>Functor</tt> implementors. For
	example, to remove the odds from a list of <tt>Integer</tt>s, one
	could write:

	<pre>
		Collection&lt;Integer&gt; numbers = new Tuple&lt;Integer&gt;(1,2,3,4,5,6,7,8);
		Collection&lt;Integer&gt; odds = Algorithms.select(numbers,
		new UnaryPredicate&lt;Integer&gt;() {
		public boolean test(Integer i) {
		return obj % 2 == 1;
		}
		});
	</pre>
</p>

<p>
	The various classes also have convenience methods for currying and
	composing functions, including the usual methods for boolean
	algebra:

	<pre>
		Collection&lt;Integer&gt; numbers = new Tuple&lt;Integer&gt;(1,2,3,4,5,6,7,8);
		UnaryPredicate&lt;Integer&gt; oddp =
		new UnaryPredicate&lt;Integer&gt;() {
		public boolean test(Integer i) {
		return obj % 2 == 1;
		}};
		UnaryPredicate&lt;Integer&gt; evenp =
		new UnaryPredicate&lt;Integer&gt;() {
		public boolean test(Integer i) {
		return obj % 2 == 0;
		}};

		Collection&lt;Integer&gt; odds = Algorithms.select(numbers, oddp);
		Collection&lt;Integer&gt; evens = Algorithms.select(numbers, evenp);
		Collection&lt;Integer&gt; all = Algorithms.select(numbers, oddp.or(evenp));
		Collection&lt;Integer&gt; nothing = Algorithms.select(numbers, oddp.and(evenp));</pre>

	The <tt>Function.Traversal</tt> class provides for
	modifying the order of evaluation of graphs and for simplifying
	graphs.
</p>

<p>
	<em>more about <tt>Serializable</tt> graphs of functors...</em>
</p>


</body>

